package xyz.labmem.app.util

import cn.hutool.core.io.file.FileReader
import com.alibaba.fastjson2.JSON
import com.alibaba.fastjson2.JSONArray
import com.alibaba.fastjson2.JSONObject
import java.io.File

/**
 * @author       : ltty
 * @description  :
 * @createDate   : 2025/5/27
 */
fun main() {
    //判断jni的区别
    val old = JSON.parseArray(
        FileReader.create(File("D:\\project\\lipx\\lipx-desktop\\app\\src\\main\\resources\\META-INF\\native-image\\jni-config.json"))
            .readString()
    )
    val new = JSON.parseArray(
        FileReader.create(File("D:\\project\\lipx\\lipx-desktop\\app\\build\\libs\\ConfigFolderName\\jni-config.json"))
            .readString()
    )
    val diff = JSONArray()
    for (n in new) {
        n as JSONObject
        var has = false
        for (o in old) {
            o as JSONObject
            if (n.getString("name") == o.getString("name")) {
                has = true
                break
            }
        }
        if (!has) {
            diff.add(n)
        }
    }
    println(diff.toJSONString())
}